<?php
/**
 * 协程redis
 * User: ahao
 * Email: 827316006@qq.com
 * Date: 2019/12/6 21:50
 */

go(function () {
    $redis = new Swoole\Coroutine\Redis();
    $redis->setOption([
        'connect_timeout' => 1,//连接超时时间
        'timeout' => 1,//读、写redis的超时时间
    ]);
    $redis->connect('0.0.0.0',6379);
    $value = $redis->set('ahao',1111);
    var_dump($value);
});